<?php
/**
 * The loop that displays posts.
 *
 */
 
 // get where trhe word is spoken
$meta_word_region = get_post_meta( get_the_ID(), 'meta_word_region', true );

 // get its part of speech
$part_of_speech = get_post_meta( get_the_ID(), 'part_of_speech', true );

 // get the synonym
$meta_word_synonym = get_post_meta( get_the_ID(), 'relation_type_syn' );

 // get the antonym
$meta_word_antonym = get_post_meta( get_the_ID(), 'relation_type_ant' );

 // get the translation
$languages = array('fr', 'en', 'ar', 'es');
$translations = array();
foreach ( $languages as $language )  {
	$translations[$language] = get_post_meta( get_the_ID(), 'translation_'.$language, true );
}

?>

&#9654 <?php echo $part_of_speech; ?>.<br /> 

<?php if( is_array($meta_word_region) && !empty($meta_word_region)) : ?>
	<!--<?php _e( 'Used in', ns_text_domaine ); ?>-->
	<ul class="meta_word_region">
		<?php foreach ( $meta_word_region as $value )  {
			
			if( ns_decode_meta( $value ) ) 
				echo '<li class="small_bull_item button rounded">'.ns_decode_meta( $value ).'</li>';	
		}?>
	</ul>
<?php endif; ?>

<div class="clear"></div>

<h2 class="rounded"><?php _e( 'Definition', ns_text_domaine ); ?></h2>
<ul class="content_fields">
	<li>
		<ul>
			<li class="tz"><span class="<?php if ( ns_is_there_tz_chars( get_the_content() ) ) echo 'tz';?>"><?php the_content(); ?></span></li>
			<li>&nbsp;</li>
			
			<?php foreach ( $translations as $key => $value )  {
				
				if( !empty($value) ) 
					echo '<li><span class="translation flag_'. $key .'"></span>'. $value .'</li>';	
			}?>
		</ul>
	</li>
</ul>

<h2 class="rounded"><?php _e( 'Thesaurus', ns_text_domaine ); ?></h2>

<ul class="content_fields">
	<li>
		<ul>
			<li><?php _e( 'Synonyms', ns_text_domaine ); ?>
				<?php if( is_array($meta_word_synonym) && !empty($meta_word_synonym[0])) : ?>
						<?php foreach ( $meta_word_synonym as $value )  {
								echo '<span class="small_bull_item button rounded"><a href="'.get_permalink($value).'" title="'.sprintf( esc_attr__( "See entry %s", ns_text_domaine ), get_the_title($value) ).'">'.get_the_title($value).'</a></span>' ;	
						}?>
				<?php else : echo ' _'; endif; ?>
			</li>
		</ul>
	</li>
	<li>
		<ul>
			<li><?php _e( 'Antonyms', ns_text_domaine ); ?>
				<?php if( is_array($meta_word_antonym) && !empty($meta_word_antonym[0])) : ?>
						<?php foreach ( $meta_word_antonym as $value )  {
								echo '<span class="small_bull_item button rounded"><a href="'.get_permalink($value).'" title="'.sprintf( esc_attr__( "See entry %s", ns_text_domaine ), get_the_title($value) ).'">'.get_the_title($value).'</a></span>' ;	
						}?>
				<?php else : echo ' _'; endif; ?></li>
		</ul>
	</li>
</ul>
<hr />
<small><?php printf( __('Added by %1$s on %2$s', ns_text_domaine), get_the_author(), date_i18n('d/m/Y', get_the_time('U', true)) ); ?></small><br /> 


<!--<h2 class="rounded">Translations</h2>
<ul class="content_fields">
	<li>
		<a href="#" class="translation_flag">
			<img src="<?php echo get_template_directory_uri(); ?>/images/flags/fr.png" width="16" height="11" />
		</a>
		<div class="translation">A friendly, informal, casual greeting said when meeting someone. Originated from the Touareg dialect meaning Hello.</div>
	</li>
	<li>
		<a href="#" class="translation_flag">
			<img src="<?php echo get_template_directory_uri(); ?>/images/flags/ar.png" width="16" height="11" />
		</a>
		<div class="rtl">التحية الرسمية بالأمازيغية و أصلها من منطقة الطوارق.</div>
	</li>
</ul>-->
